package com.example.demo.utils;

import org.aspectj.lang.JoinPoint;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Method;

public class AspectUtil {

    public static @Nullable Method getMethodByJoinPoint(JoinPoint joinPoint) {
        Class<?> type = joinPoint.getSignature().getDeclaringType();
        String methodName = joinPoint.getSignature().getName();
        for(Method method : type.getDeclaredMethods())
            if(methodName.equals(method.getName()))
                return method;
        return null;
    }

}
